const {createApp} = Vue;
	const app = createApp({
		data(){
			return{
				goods,
				// 配送费
				deliveryPrice:5,
				// 起送门槛
				deliveryThreshold:30
			}
		},
		methods:{
			increse(item){
				item.chooseNum++;
				item.allPrice = item.price * item.chooseNum
			},
			decrese(item){
				if(item.chooseNum <= 0){
					return
				}
				item.chooseNum--;
				item.allPrice = item.price * item.chooseNum
			}
		},
		mounted(){
			this.goods = this.goods.map(val => {
				return {
					...val,
					chooseNum:0,
					allPrice:0
				}
			})
		},
		computed:{
			payInfo(){
				let sumPrice = 0;
				let sumNum = 0;
				this.goods.forEach(val =>{
					sumPrice += val.allPrice;
					sumNum += val.chooseNum;
				})
				return {
					payPrice:sumPrice,
					sumNum,
					thretholdPrice:this.deliveryThreshold - sumPrice
				};
			}
		}
	});
	const vm = app.mount("#app")